package com.trkj.service.wdm;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.trkj.dao.wdm.ContractCategoryDAO;
import com.trkj.pojo.ContractCategory;
import com.trkj.service.ServiceException;

@Service
/**
 * 人事的单表
 * @author lenovo
 *
 */
@Transactional(rollbackFor=Exception.class)
public class OneTableService {
	@Autowired
	private ContractCategoryDAO conDao;

	/**
	 * 查询合同类型总记录数
	 * @return
	 */
	public long PageContractCategory(){
		return conDao.count();
	}
	/**
	 * 合同类型
	 * 查询所有
	 * @param page
	 * @param rows
	 * @return
	 */
	public List<ContractCategory> findAllContractCategory(int page,int rows) throws ServiceException{
		try {
			return conDao.queryByNaPage(new PageRequest(page-1,rows,Direction.DESC,"concaFoundtime"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new ServiceException(e);
		}
	}
	
	
}
